home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8532 < prev    next >
Encoding:
Text File  |  1996-08-05  |  620 b   |  31 lines

  1. Path: newsbf02.news.aol.com!not-for-mail
  2. From: razine@aol.com (Razine)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Convert String to Int?
  5. Date: 4 Mar 1996 17:48:53 -0500
  6. Organization: America Online, Inc. (1-800-827-6364)
  7. Sender: root@newsbf02.news.aol.com
  8. Message-ID: <4hfs0l$k2i@newsbf02.news.aol.com>
  9. References: <4hf3sk$k57@hustle.rahul.net>
  10. Reply-To: razine@aol.com (Razine)
  11. NNTP-Posting-Host: newsbf02.mail.aol.com
  12.  
  13. I would suggest using atoi.
  14.  
  15. example
  16.  
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19.  
  20. int main()
  21. {
  22.  
  23.   char number[3]='999';
  24.   int result;
  25.  
  26.   result=atoi(number);
  27.   printf("Result == %d\n",result);
  28.   return 0;
  29.  
  30.